"""
配置文件
包含数据库路径、模型路径等配置信息
"""

from pathlib import Path

# 项目根目录
PROJECT_ROOT = Path(__file__).parent.parent.absolute()

# 数据库配置
DB_PATH = PROJECT_ROOT / "housing.db"
DB_TABLE_NAME = "housing_data"

# 模型保存目录
MODELS_DIR = PROJECT_ROOT / "saved_models"

# 模型文件名
MODEL_FILES = {
    "rf_model": "rf_model.pkl",
    "svm_model": "svm_model.pkl", 
    "elastic_model": "elastic_model.pkl",
    "scaler": "scaler.pkl",
    "feature_names": "feature_names.pkl",
    "X_test": "X_test.pkl",
    "y_test": "y_test.pkl",
    "rf_grid": "rf_grid.pkl",
    "svm_grid": "svm_grid.pkl",
    "elastic_grid": "elastic_grid.pkl"
}

# 机器学习参数
RANDOM_STATE = 42
TEST_SIZE = 0.2
CV_FOLDS = 5

# 随机森林参数网格
RF_PARAM_GRID = {
    'n_estimators': [100, 200, 300],
    'max_depth': [10, 15, 20, None],
    'min_samples_split': [2, 5, 10],
    'min_samples_leaf': [1, 2, 4]
}

# SVM参数网格
SVM_PARAM_GRID = {
    'C': [0.1, 1, 10, 100],
    'gamma': ['scale', 'auto', 0.001, 0.01, 0.1],
    'kernel': ['rbf', 'linear']
}

# 弹性网络参数网格
ELASTIC_PARAM_GRID = {
    'alpha': [0.001, 0.01, 0.1, 1, 10],
    'l1_ratio': [0.1, 0.3, 0.5, 0.7, 0.9],
    'max_iter': [1000, 2000]
}

# 特征选择
TOP_FEATURES_COUNT = 5
SAMPLE_SIZE_FOR_VISUALIZATION = 500
